package com.zhl.projectmerger.strategy;

import com.zhl.projectmerger.ProjectMergeConfig;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.FieldDeclaration;
import com.github.javaparser.ast.body.MethodDeclaration;


public class ControllerMergeStrategy extends AbtractMergeStrategy {
    @Override
    public boolean match(ClassOrInterfaceDeclaration fromClass, ClassOrInterfaceDeclaration toClass, ProjectMergeConfig mergerConfig) {
        String className = fromClass.getName().getIdentifier();
        return className.toLowerCase().endsWith("Controller".toLowerCase());
    }

    @Override
    public void importProcess(CompilationUnit from, CompilationUnit to) {
        super.importProcess(from, to);
    }

    @Override
    public void classFileAnnotationProcess(ClassOrInterfaceDeclaration from, ClassOrInterfaceDeclaration to) {
        super.classFileAnnotationProcess(from, to);
    }

    @Override
    public void fieldsMerge(ClassOrInterfaceDeclaration toClass, FieldDeclaration fieldDeclaration) {
        super.fieldsMerge(toClass, fieldDeclaration);
    }

    @Override
    protected void doFieldsMerge(FieldDeclaration fromFieldDeclaration, FieldDeclaration toFieldDeclaration) {

    }

    @Override
    public void methodMerge(ClassOrInterfaceDeclaration toClass, MethodDeclaration methodDeclaration) {
        super.methodMerge(toClass, methodDeclaration);
    }

    @Override
    protected void doMethodMerge(MethodDeclaration fromMethodDeclaration, MethodDeclaration toMethodDeclaration) {

    }
}
